package com.yuanfeng.goods.controller;

import com.yuanfeng.commoms.util.ResponseResult;
import com.yuanfeng.goods.dto.ManageByTypeIdParamInfoDTO;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @ClassName GoodsPropertyController
 * @Description
 * @Author hyq
 * @Date 2023/7/18 9:08
 * @Version 1.0
 **/
@RestController
@RequestMapping("/goods/property")
public class GoodsPropertyController extends BaseController{


    /**
     * 删除商品属性
     *
     * @param param
     * @return
     */
    @PostMapping("/delete")
    public ResponseResult deteleGoodsProperty(@RequestBody Map<String, Object> param) {
        ResponseResult result=goodsPropertyService.deteleGoodsProperty(param);
        return result;
    }


    /**
     * 新增或更新商品属性
     *
     * @param param
     * @return
     */
    @PostMapping("/add")
    public ResponseResult addGoodsProperty(@RequestBody Map<String, Object> param) {
        ResponseResult result=goodsPropertyService.addGoodsProperty(param);
        return result;
    }

    /**
     * 根据typeId查询商品发布相关信息
     *
     * @param param
     * @return
     */
    @PostMapping( "/typeid/query")
    public ResponseResult queryByTypeId(@RequestBody ManageByTypeIdParamInfoDTO param) {
        ResponseResult result = goodsPropertyService.queryByTypeId(param);
        return result;
    }
}
